package com.taoyun.mapper;

import com.taoyun.pojo.entity.FileBelongGroup;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.logging.log4j.core.config.plugins.PluginAliases;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * F_belong_G持久层接口
 * @author liuyucai
 */
@Repository
public interface FileBelongGroupMapper {

    //添加文件归属群组记录
    @Insert("insert into F_belong_G(G_Id, F_Id, GroupId) values(#{G_Id}, #{F_Id}, #{GroupId})")
    Integer addFBelongG(FileBelongGroup fileBelongGroup);

    //根据GroupId查询该群组的所有文件F_id
    @Select("select F_Id from F_belong_G where GroupId = #{GroupId}")
    List<Integer> SelectFileIdsByGroupId(@Param("GroupId") Integer GroupId);

    //根据GroupId删除记录
    @Delete("delete from F_belong_G where GroupId = #{GroupId}")
    Integer DeleteByGroupId(@Param("GroupId") Integer GroupId);

    //根据G_Id删除记录(XML配置)
    Integer DeleteByGIdBatch(@Param("G_Ids")List<Integer> G_Ids);
}
